/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package SintaticoPacote;

import compilador_full.TabelaSimbolos;

/**
 *
 * @author Laue
 */
public class cmdRepeticao {

    CmdWhile laco1 = new CmdWhile();
    CmdDoWhile laco2 = new CmdDoWhile();
    CmdFor laco3 = new CmdFor();

    public boolean comandoRepeticao(TabelaSimbolos tabelaSimbolos) {

        if (tabelaSimbolos.getLookahead().equals("while")) {
//            if(tabelaSimbolos.reconhecer("while"))
//            {
            if (laco1.sintaxeWhile(tabelaSimbolos)) {
                return true;
            } else {
                return false;
            }
//            }
//            else
//                return false;
        } 
        
        else if (tabelaSimbolos.getLookahead().equals("do")) {
            
                if (laco2.sintaxeCmdDoWhile(tabelaSimbolos)) {
                    return true;
                } else {
                    return false;
                }
            
        } 
        
        else if (tabelaSimbolos.getLookahead().equals("for")) {
                if (laco3.sintaxeCmdFor(tabelaSimbolos)) {
                    return true;
                } else {
                    return false;
                }
        }
        else {
            return false;
        }
    }
}
